/*
 * Copyright 2019 Esri
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.esri.arcgisruntime.toolkit.extension

import androidx.test.ext.junit.runners.AndroidJUnit4
import com.esri.arcgisruntime.UnitSystem
import junit.framework.Assert.assertSame
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Instrumented unit tests for ArcGISExtensions
 *
 * @since 100.5.0
 */
@RunWith(AndroidJUnit4::class)
class ArcGISExtensionsTest {

    /**
     * Tests that the supplied ints map to the correct [UnitSystem].
     *
     * @since 100.5.0
     */
    @Test
    fun unitSystemFromIntMappingCorrect() {
        assertSame(unitSystemFromInt(0), UnitSystem.IMPERIAL)
        assertSame(unitSystemFromInt(1), UnitSystem.METRIC)
    }

    /**
     * Tests that an [IllegalArgumentException] is thrown when [unitSystemFromInt] is provided with an int that is neither
     * 0 or 1.
     *
     * @since 100.5.0
     */
    @Test(expected = IllegalArgumentException::class)
    fun unitSystemFromIntInvalidArgumentThrowsException() {
        unitSystemFromInt(-1)
    }

}
